package com.shqcjd.sinopecdemomobile.ui.adapter;

import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shqcjd.sinopecdemomobile.R;
import com.shqcjd.sinopecdemomobile.model.pojo.EquipmentAbnormalBean;
import com.shqcjd.sinopecdemomobile.ui.activity.EquipmentAbnormalActivity;

import java.util.List;

public class EquipmentAbnormalAdapter extends BaseQuickAdapter<EquipmentAbnormalBean.EquipmentPartBean,BaseViewHolder> {
    private EquipmentAbnormalActivity context;
    private int epId;
    public EquipmentAbnormalAdapter(@Nullable List<EquipmentAbnormalBean.EquipmentPartBean> data, EquipmentAbnormalActivity context, int epId) {
        super(R.layout.item_equipment_abnormal, data);
        this.context = context;
        this.epId = epId;
    }

    @Override
    protected void convert(BaseViewHolder helper, EquipmentAbnormalBean.EquipmentPartBean item) {
        helper.setText(R.id.tv_item_equipment_abnormal_title, item.equipment_part_name);

        RecyclerView mRecyclerView = helper.getView(R.id.rv_item_equipment_abnormal);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(context));
        EquipmentAbnormalItemAdapter equipmentAbnormalItemAdapter = new EquipmentAbnormalItemAdapter(item.equipment_part_item, context, epId);
        mRecyclerView.setAdapter(equipmentAbnormalItemAdapter);

    }

}
